Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kernelCTF CVE-2023-4244_mitigation #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mingi
Copy link
Contributor

@mingi mingi commented Feb 10, 2025

No description provided.

Copy link

google-cla bot commented Feb 10, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@koczkatamas koczkatamas force-pushed the master branch 3 times, most recently from 933028d to c111d81 Compare March 3, 2025 14:31
@koczkatamas koczkatamas force-pushed the master branch 13 times, most recently from 76d6b57 to bf0d68f Compare March 13, 2025 15:39
Copy link
Collaborator

@koczkatamas koczkatamas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey,

This is just a quick code quality review. We're planning to review the submissions more deeply (actually understanding what the exploit does) next week.

In general, the code quality looks good, no major concerns. I've left a few smaller comments.

We also have a draft style guide now. Please take a look and let us know if it's helpful for understanding our code quality expectations: https://google.github.io/security-research/kernelctf/style_guide.

Thanks for the submission and PR!

struct nlmsghdr * nlh;
struct mnl_nlmsg_batch * batch;
struct mnl_socket * nl;
uint32_t portid;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable is only set, but never used again, can we remove it if it is not necessary?

See our (draft) style guide for more details.

uint64_t kbase = 0;

char* buf;
struct nlmsghdr * nlh;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that these variables could've been locals instead of global ones. Our rationale why moving these into locals can improve readability is in our style guide.

struct mnl_nlmsg_batch * batch;
struct mnl_socket * nl;
uint32_t portid;
uint8_t family = NFPROTO_IPV4;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to use a variable for this and not use NFPROTO_IPV4 directly in the code? If we want to make this configurable then we prefer a #define or const variable, making clear that this variable won't change during the exploit (so it's a constant).

char * chain_base_name = "chain1";
char * chain_rop_name = "chain_rop";

size_t KERNEL_BASE = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nftnl_set_set_u32(set, NFTNL_SET_GC_INTERVAL, 1);
nftnl_set_set_u32(set, NFTNL_SET_DATA_TYPE, NFT_DATA_VERDICT);

uint8_t key_data[0x200] = {0,};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the size of key_data matter (0x200)? Does this influence e.g. which cache is used? Please comment here details: https://google.github.io/security-research/kernelctf/style_guide#name-andor-comment-numeric-constants

nftnl_set_set_u32(set, NFTNL_SET_DATA_TYPE, NFT_DATA_VERDICT);

uint8_t key_data[0x200] = {0,};
uint8_t key_end_data[0x2000] = {0,};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables key_end_data and user_data are not used, please remove them: https://google.github.io/security-research/kernelctf/style_guide#unused-code

@koczkatamas
Copy link
Collaborator

Also please sign the CLA with your other email address too. Currently the CLA check fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants